/*
 * UnitScreen.h
 *
 *  Created on: 2013-1-19
 *      Author: heqiu
 */

#ifndef UNITSCREEN_H_
#define UNITSCREEN_H_
#include <stdio.h>
#include <stdlib.h>
#include "GuudColor.h"
#include "GuudPoint.h"
#include "GuudSurface.h"
#include "UnitMap.h"
#include "GuudFont.h"
#include "UnitBuilding.h"
#include "GuudLock.h"
#include "UnitControl.h"
namespace guud {

class UnitScreen {
public:
	UnitScreen();
	bool init(uint32_t uiWidth, uint32_t uiHeight, uint32_t uiBpp,
			uint32_t uiWinPixel, const char * pName);
	//白屏
	void white();
	//显示
	void show();
	int32_t getWinPosX();
	int32_t getWinPosY();
	uint32_t getWinWidth();
	uint32_t getWinHeight();
	//显示坐标点
	void drawCoordinate(int32_t iX, int32_t iY, UnitMap & stUnitMap,
			GuudFont & stFont);
	//显示所有可见坐标点
	void drawCoordinate(UnitMap & stUnitMap, GuudFont & stFont);
	//从远到近循环可见坐标
	void cycle(UnitMap & stUnitMap, void (*func)(int32_t, int32_t));
	//标记坐标点
	void drawMarkPoint(GuudPoint pw);
	//画建筑
	void drawBuilding(UnitMap & stUnitMap, uint32_t uiNo,
			UnitBuilding * pBuilding);
	//画控制面板
	void drawControl(UnitControl & stUnitControl);

	//鼠标拖动
	void mouseMoving(uint16_t uiX, uint16_t uiY);
	void mouseUp(uint16_t uiX, uint16_t uiY);
	void mouseDown(uint16_t uiX, uint16_t uiY);

	GuudPoint m_stPixelPos;
	uint32_t m_uiWidth;
	uint32_t m_uiHeight;
	uint32_t m_uiWinPixel;	//每一个坐标对应的像素大小
	GuudSurface m_GuudSurface;

	//拖动相关
	bool m_bMoveing;
	uint16_t m_uiLastX;
	uint16_t m_uiLastY;
	GuudLock m_lock;
};
}

#endif /* UNITSCREEN_H_ */
